home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Kentucky Virtual Art Museum
/
Kentucky Virtual Art Museum.iso
/
site
/
museums
/
zoomify
/
grcstatue1.swf
/
scripts
/
ZoomifyToolbarSymbol.as
next >
Wrap
Text File
|
2005-08-04
|
3KB
|
102 lines
function ZoomifyToolbar()
{
this.gSliderIsDown = false;
this.gSliderY = 0;
callbackName = targetPath(this) + ".viewChangedCallback";
this.getImageInstance().registerCallback("View",callbackName);
this.update();
}
ZoomifyToolbar.prototype = new MovieClip();
Object.registerClass("ZoomifyToolbarSymbol",ZoomifyToolbar);
ZoomifyToolbar.prototype.viewChangedCallback = function(instance, x, y, zoom)
{
this.adjustSlider();
};
ZoomifyToolbar.prototype.update = function()
{
this.ZoomSlider_mc._visible = this._showSlider;
};
ZoomifyToolbar.prototype.setSliderVisibility = function(sliderVisibility)
{
this._showSlider = sliderVisibility;
this.update();
};
ZoomifyToolbar.prototype.adjustSlider = function()
{
if(this.gSliderY == 0)
{
this.gSliderY = this.ZoomSlider_mc._y;
}
var _loc5_ = this.getImageInstance().getZoom();
var _loc2_ = this.getImageInstance()._minZoom;
var _loc3_ = this.getImageInstance()._maxZoom;
if(_loc3_ == -1)
{
_loc3_ = this.getImageInstance().calculateScreenZoom();
}
if(_loc2_ == -1)
{
_loc2_ = this.getImageInstance().calculateScreenZoom();
}
var _loc4_ = this.background_mc._width;
this.ZoomSlider_mc._x = (- _loc4_) / 2 + _loc4_ * ((_loc5_ - _loc2_) / (_loc3_ - _loc2_));
this.ZoomSlider_mc._y = this.gSliderY;
};
ZoomifyToolbar.prototype.sliderDragged = function()
{
if(this.gSliderIsDown == true)
{
if(this.gSliderY == 0)
{
this.gSliderY = this.ZoomSlider_mc._y;
}
var _loc7_ = this.getImageInstance().getZoom();
var _loc3_ = this.getImageInstance()._minZoom;
var _loc4_ = this.getImageInstance()._maxZoom;
if(_loc4_ == -1)
{
_loc4_ = this.getImageInstance().calculateScreenZoom();
}
if(_loc3_ == -1)
{
_loc3_ = this.getImageInstance().calculateScreenZoom();
}
var _loc2_ = this.background_mc._width;
if(this.ZoomSlider_mc._x > _loc2_ / 2)
{
this.ZoomSlider_mc._x = _loc2_ / 2;
}
if(this.ZoomSlider_mc._x < (- _loc2_) / 2)
{
this.ZoomSlider_mc._x = (- _loc2_) / 2;
}
var _loc5_ = this.ZoomSlider_mc._x;
var _loc6_ = _loc3_ + (_loc4_ - _loc3_) * ((_loc5_ + _loc2_ / 2) / _loc2_);
this.ZoomSlider_mc._y = this.gSliderY;
this.getImageInstance().setZoom(_loc6_);
}
};
ZoomifyToolbar.prototype.getImageInstance = function()
{
var imageInstance = null;
if(this._targetZoomifyViewer.substring(0,5) == "_root" || this._targetZoomifyViewer.substring(0,6) == "_level")
{
imageInstance = eval(this._targetZoomifyViewer);
}
else
{
imageInstance = this._parent[this._targetZoomifyViewer];
}
return imageInstance;
};
ZoomifyToolbar.prototype.sliderReleased = function()
{
this.sliderDragged();
this.gSliderIsDown = false;
this.getImageInstance().updateView();
};
ZoomifyToolbar.prototype.sliderPressed = function()
{
this.gSliderIsDown = true;
};